home *** CD-ROM | disk | FTP | other *** search
- MODLNK04 -- WFCMOD.TXT
- This is Doorman's WFC mod in two parts. The second is an add-on to the first
- and, far as I can tell, the first will work without the second...
- -=><=-
- ══════════════════════════════════════════════════════════════════════════════
-
- The Doorman #67 @18858
- Sun Dec 29 14:14:29 1991
- Yes you guessed it, another waiting for call mod. This mod isn't
- quite finished, but I've been asked to release it. It adds some
- stuff I hadn't seen in other WFC mods. Mainly, most WFC mods only
- print the information when the caller logs off; not with this one,
- it continues to update while waiting for a call. To do this, I had
- to implement some direct memory screen writes.
-
- It has been tested on both monicrome and VGA monitors and works fine.
- The screen blanker(yes, it blanks the screen after 5 minutes!!!) is
- quite simple and you can change it as you like.
-
- About the writer..I'm currently 21 and been programming for about
- 6 years. I attend The College of Charleston in Charleston, SC where
- I am majoring in Computer Science with minors in Math(if I can pass
- Calculus 3!) and Physics; and I would like to thank wayne for writing
- this BBS so I could learn C.
-
- Ok, about the mod now; it is very simple, just add the functions where
- it says to, and then where it says + add those lines where it says! The
- rest should be commented well enough to help you.
-
- -----------------------------------------------------------------
- I believe that you need to add
- #include <conio.h>
- to your BBS.C. It has to be the one which has the _setcursor and
- NOCURSOR within it.
- -----------------------------------------------------------------
- In the Externs add:
- extern int num_call_sys,num_ncn;
- extern net_cotact_rec *ncn;
- extern net_call_out_rec *con;
- -----------------------------------------------------------------
- Just cut and paste in the following functions into BBS.C before
- getcaller:
- vmode,my_putchar,my_printf,printstatus,do_wfc
- -----------------------------------------------------------------
- int VSEG;
- void vmode()
- /*
- This function sets the global variable VSEG to the proper
- setting for monicrome or non-monicrome(CGA,EGA,VGA,etc..)
- */
- {
- static union REGS rg;
-
- rg.h.ah = 15;
- int86(16,&rg,&rg);
- VSEG = (rg.h.al == 7 ? 0xb000 : 0xb800);
- }
-
- void my_putchar(int ch,int x,int y)
- /*
- This function puts the character ch directly into the video
- memory at locations x and y
- */
- {
- int vch;
-
- vch = (ch&255)|(WHITE<<8);
- poke(VSEG,((y)*160+(x)*2),vch);
- }
-
- void my_printf(char *string,...)
- /*
- My_printf works just like printf, except it prints each
- character with my_putchar using direct screen writes
- */
- {
- char line[100],*dline = line;
- int x=wherex(),y=wherey();
-
- va_list ap;
- va_start(ap,string);
- vsprintf(line,string,ap);
- va_end(ap);
- while (*dline)
- my_putchar(*dline++,x++,y);
- }
-
- void printstatus(char *string)
- /*
- Printstatus is just the beginning to be added to further in
- the future. It takes the string sent to it, and prints it
- on a "status-line" on line 21. This function will be used
- further in the future described at the bottom of the mod.
- */
- {
- char printstring[35];
- int counter;
-
- strncpy(printstring,string,34);
- while ((int)strlen(printstring) < 34)
- strcat(printstring," ");
- gotoxy(23,24);
- my_printf(printstring);
- }
-
- int x=1,y=1,forward=1,down=1,printlocal,thisnet=0;
- time_t lastcall,timelast;
- void do_wfc(int printinfo)
- /*
- Yes you guessed it, this is the heart of the mod. It prints
- all information to go in the mod.
- */
- {
- char string[255],ch,s1[81];
- int h,m,s,am=1,i1,i2;
- long l1;
- double t;
- time_t timenow;
- net_system_list_rec *csne;
-
- if (printinfo) /* If the screen is blanked or not */
- {
- gotoxy(7,2);
- my_printf(date());
- gotoxy(40-((int)strlen(syscfg.systemname)/2),2);
- my_printf(syscfg.systemname);
- t=timer();
- h=(int) (t/3600.0);
- t-=((double) (h)) * 3600.0;
- m=(int) (t/60.0);
- t-=((double) (m)) * 60.0;
- if (h==0)
- h = 12;
- if (h>12)
- {
- h -= 12;
- am = 0;
- }
- gotoxy(66,2);sprintf(string,"%02d:%02d %s",h,m,(am) ? "am" : "pm");my_printf(string);
- /* Board Statistics */
- gotoxy(30,6);sprintf(string,"%4d(%4d)",status.users,syscfg.maxusers-status.users);my_printf(string);
- gotoxy(30,8);sprintf(string,"%10d",status.callernum1);my_printf(string);
- gotoxy(30,10);my_printf(VERSION_NUMBER);
- gotoxy(30,12);sprintf(string,"%s",(sysop2()) ? "Available" : "Not ");my_printf(string);
- gotoxy(30,14);sprintf(string,"%s",(syscfg.closedsystem) ? "Closed" : "Open ");my_printf(string);
- gotoxy(30,16);
- time(&timenow);
- t = difftime(timenow,lastcall);
- h=(int) (t/3600.0);
- t-=((double) (h)) * 3600.0;
- m=(int) (t/60.0);
- t-=((double) (m)) * 60.0;
- s=(int)t;
- sprintf(string,"%02d:%02d:%02d",h,m,s);
- my_printf(string);
- gotoxy(30,18);
- if (syscfg.executetime)
- {
- t = (double)(syscfg.executetime*60) - timer();
- if (t<0.0)
- t+=24.0*3600.0;
- h=(int) (t/3600.0);
- t-=((double) (h)) * 3600.0;
- m=(int) (t/60.0);
- t-=((double) (m)) * 60.0;
- s=(int)t;
- sprintf(string,"%02d:%02d:%02d",h,m,s);
- }
- else
- sprintf(string,"No Event");
- my_printf(string);
-
- /*Daily Status*/
- gotoxy(62,6);sprintf(string,"%5d",status.callstoday);my_printf(string);
- gotoxy(62,8);sprintf(string,"%5d",status.msgposttoday);my_printf(string);
- gotoxy(62,10);sprintf(string,"%5d",status.emailtoday);my_printf(string);
- gotoxy(62,12);sprintf(string,"%5d",fwaiting);my_printf(string);
- gotoxy(62,14);sprintf(string,"%5d",status.uptoday);my_printf(string);
- gotoxy(62,16);sprintf(string,"%5d",status.activetoday);my_printf(string);
- gotoxy(62,18);
- if ((int)timer() != 0)
- sprintf(string,"%5.2f",100.00*((float)status.activetoday)/((float)timer()/60.00));
- else
- sprintf(string,"00.00");
- my_printf(string);
- /* Print Network Information */
- /* Alternate system to print every 5 seconds */
- if ((int)difftime(timenow,timelast) >= 5)
- {
- i2=-1;
- while (i2 == -1)
- {
- thisnet = (thisnet < num_ncn) ? thisnet+1 : 0;
- csne=next_system(ncn[thisnet].systemnumber);
- i2=-1;
- for (i1=0;i1<num_call_sys;i1++)
- if (con[i1].sysnum==ncn[thisnet].systemnumber)
- i2=i1;
- }
- time(&timelast);
- if (ok_to_call(i2))
- ch='*';
- else
- ch=' ';
- if (ncn[thisnet].lastcontact)
- {
- l1=timenow-ncn[thisnet].lastcontact;
- s=l1%60;l1=(l1-s)/60;
- m=l1%60;
- h=l1/60;
- sprintf(s1,"%02d:%02d:%02d",h,m,s);
- }
- else
- sprintf(s1," -NEVER-");
- gotoxy(7,22);
- sprintf(string,"%5d%c│%-30.30s│%-12.12s│%7ld│%8s",
- ncn[thisnet].systemnumber, ch, csne->name, csne->phone,
- ncn[thisnet].bytes_waiting,s1);
- my_printf(string);
- }
- printstatus("Waiting for Call");
- }
- else /* Else blank the screen */
- {
- gotoxy(x,y);
- my_printf(" "); /* clear the previous message */
- if (forward)
- x++;
- else
- x--;
- if (down)
- y++;
- else
- y--;
- gotoxy(x,y);
- if (forward && x > 75)
- forward = 0;
- else if (!forward && x < 2)
- forward = 1;
- if (down && y > 23)
- down = 0;
- else if (!down && y < 2)
- down = 1;
- my_printf("WWIV"); /* Change it to what you want */
- }
- }
-
- ----------------------------------------------------------------------
- Now, change the following places in getcaller:
- + : add something
- = : find this line
- ----------------------------------------------------------------------
-
- void getcaller()
- {
- char s[81],s1[81],ch,done,lokb;
- + int i,i1,i2,i3,printinfo=1; /*Add printinfo*/
- double d,d1;
- long l,l1;
- + time_t starttime,timenow; /*add this entire line*/
-
- = d-=floor(d);
- = d*=10000.0;
- = srand((unsigned int)d);
- + _setcursortype(_NOCURSOR);
- + time(&starttime);
- + sprintf(s,"%swfc.com",syscfg.gfilesdir);
- + if (!access(s,00))
- + run_external(s);
- + else
- + {
- + clrscr();
- + printfile("wfc");
- + }
- = do {
- + time(&timenow);
- + if ((int)difftime(timenow,starttime) > (5*60))
- + {
- + clrscr();
- + printinfo = 0;
- + }
- + /* I never liked having to wait until after the user
- + logged on for the daily maintance. This will run
- + it as soon as the day changes */
- + if (strcmp(date(),status.date1) != 0)
- + {
- + printstatus("Running Maintance");
- + beginday();
- + }
- = wfc=1;
- + printlocal=1;
-
-
- = if (do_event)
- = {
- = run_event();
- + sprintf(s,"%swfc.com",syscfg.gfilesdir);
- + if (!access(s,00))
- + run_external(s);
- + else
- + {
- + clrscr();
- + printfile("wfc");
- + }
- = }
- = lokb=0;
- = strcpy(curspeed,"KB");
- = if (((rand() % 8000)==0) && (syscfg.systemnumber) && (ok_modem_stuff))
- = {
- + clrscr();
- = attempt_callout();
- + sprintf(s,"%swfc.com",syscfg.gfilesdir);
- + if (!access(s,00))
- + run_external(s);
- + else
- + {
- + clrscr();
- + printfile("wfc");
- + }
- = }
- = okskey=0;
- = ch=upcase(inkey());
- = if (ch) {
- + _setcursortype(_NORMALCURSOR);
- + printlocal=0;
- + printinfo=1;
- + clrscr();
- .
- .
- .
- = if (!incom) {
- = frequent_init();
- = read_user(1,&thisuser);
- = fwaiting=thisuser.waiting;
- = usernum=1;
- + if (!lokb)
- + {
- + sprintf(s,"%swfc.com",syscfg.gfilesdir);
- + if (!access(s,00))
- + run_external(s);
- + else
- + {
- + clrscr(); /**/
- + printfile("wfc");
- + }
- + _setcursortype(_NOCURSOR);
- + time(&starttime);
- + printlocal=1;
- + }
-
- /* This is the else from if ch=inkey() above */
- + else
- + do_wfc(printinfo);
- .
- .
- .
- /* I just commented out the out1ch(12) which just blanks the
- screen */
- if (!incom) {
- /* out1ch(12);*/
- imodem();
- .
- .
- }
- = } while ((!incom) && (!lokb) && (!endday));
- + clrscr();
- + _setcursortype(_NORMALCURSOR);
- = using_modem=incom;
- = if (lokb==2)
- = using_modem=-1;
- = okskey=1;
- = if (!endday) {
- + sprintf(s,"Logging on at %s...",curspeed);/*Removed \x0c...\r\n*/
- = outs(s);
- = }
- + printlocal=0;
- = wfc=0;
- =}
- --------------------------------------------------------------
- Change the following lines in imodem in BBS.C
-
- = if (!ok_modem_stuff) {
- /* outs("\x0c");*/ /* Just comment out the outs("\x0c");
- it just blanks the screen */
- = return;
- = }
- +/* outs("\x0cWaiting...");*/outs("Waiting..."); /* Replace first
- with second */
- = rts(1);
- = dtr(1);
- /* At end of function comment out or remove the following line */
- /* outs("\x0c");*/
- = wait1(2);
- }
- --------------------------------------------------------------
- Change the following lines in gotcaller in BBS.C
-
- sprintf(s,"Logging on at %s...",curspeed);/*Removed \x0c..\r\n*/
- = outs(s);
- = using_modem=1;
- --------------------------------------------------------------
- Add the following lines to main in BBS.C
-
- = init(1);
- + vmode();
- + time(&lastcall);
- + time(&timelast);
- + timelast-=(long)10;
- .
- .
- .
- = mainmenu();
- = }
- = logoff();
- + time(&lastcall);
- = }
- --------------------------------------------------------------
- Add to CONIO.C
-
- at the end of the extern add:
- extern int printlocal;
-
- =void outs(char *s)
- =/* This (obviously) outputs a string TO THE SCREEN ONLY */
- ={
- = int i;
- = char ch;
- =
- + if (printlocal) /*MOD*/
- + printstatus(s);
- = else
- = for (i=0; s[i]!=0; i++) {
- --------------------------------------------------------------
- Here is the WFC.MSG that I use. You can also take any ansi editor which
- will allow you to save it as an executable and do that.
- --------------------------------------------------------------
- ┌────────┬─────────────────────────────────────────────────┬────────┐
- │ │ │ │
- └──────┬─┴────────────────────────╥────────────────────────┴─┬──────┘
- │BBS Statistics ║Total for Today │
- ├───────────────┬──────────╫────────────────────┬─────┤
- │# Users(Left) │ ║Calls │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │# Calls │ ║Messages Posted │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │WWIV Version # │ ║Email Sent │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Sysop │ ║Feedback Waiting │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Board │ ║Uploads │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Time since call│ ║Minutes Users Online│ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Time Til Event │ ║% Active Today │ │
- ┌──────┼───────────────┴──────────╨───┬────────────┬───┴───┬─┴──────┐
- │Node *│System Name │Phone │ Bytes │Last Con│
- ╞══════╪══════════════════════════════╪════════════╪═══════╪════════╡
- │ │ │ │ │ │
- ╘══════╧════════╤═════════════════════╧════════════╧╤══════╧════════╛
- │ │
- └───────────────────────────────────┘
- ---------------------------------------------------------------
- From there on, just hit F9. But I'd suggest using the Make.
- If you don't use make, you might want to consider it; you can
- put your BBS files in a seperate directory from TC, get output
- in a different directory, and your executables in yet another one.
- Not to mention that it (I believe) is a 2-pass compiler(TCC) and
- it will optomize your code better.
-
- Now for the future of this mod, I plan on eventually making it so
- it will keep the WFC info in the screen while a caller is online
- and allow the SYSOP to press a key and then see what is being printed,
- while having the bottom box(see next message) show what the user
- is currently doing.
-
- I tried to remember everything I had changed, but knowing me I may have
- forgotten something. If I did, I can be reached at 1@8301 or
- call my BBS "The Thieves Market" at 803-723-7254 300-14400b and I
- autovalidate ANY-Sysop.
-
- Or if you feel like waisting money, you can call me at my voice line:
- 803-853-7632
- Ask for David
-
- I can't think of anything else to say, except the normal disclammer that
- It has been tested on my BBS, with no problems, but I take no responsability
- to what it does to you, your computer, your mother, your mothers blue hair
- or any non mentioned items. But I am willing to help with any sort of
- problems you may have.
-
- PS, where I took out all the 0xc and \n\r lines, that was to make it
- look prettier(ie not blank the screen and mess up how it looks). That
- may be what I forgot, some 0xc someplace and it blanks the screen.
-
- ──────────────────────────────────────────────────────────────────────────────
-
- The Doorman #67 @18858
- Sun Dec 29 14:15:42 1991
- For those of you who have used my WFC modification, here is an
- update to it to support network information. It will not only
- print the old information, but it will now print network pending
- info. It will change between different connections every 5
- seconds. Enjoy and good luck.
-
- -----------------------------------------------------------------
- (PS This is an addition to my WFC MOD, if you don't have my WFC
- MOD installed DON'T use this, it will only cause errors. Get
- a copy of my WFC MOD and try it!)
- -----------------------------------------------------------------
-
- In the Externs of BBS.C add:
- extern int num_call_sys,num_ncn;
- extern net_cotact_rec *ncn;
- extern net_call_out_rec *con;
-
- ------------------------------------------------------------------
- In the print_status function change the line:
- gotoxy(23,21);
- to
- gotoxy(23,24);
- ------------------------------------------------------------------
- Before the do_wfc function add the variables:
- = int x=1,y=1,.....thisnet=0;/*Add thisnet*/
- = time_t lastcall,timelast;/*Add timelast*/
- ------------------------------------------------------------------
- In do_wfc change all the y coordinates in the gotoxy(x,y) function.
- Subtract 1 from all the y's.
-
- ex:
- OLD:
- /* Board Statistics */
- = gotoxy(30,7);sprintf(string,"%4d(%4d)",status.users,syscfg.maxusers-status.users);my_printf(string);
- = gotoxy(30,9);sprintf(string,"%10d",status.callernum1);my_printf(string);
- = gotoxy(30,11);my_printf(VERSION_NUMBER);
-
- NEW:
- /* Board Statistics */
- + gotoxy(30,6);sprintf(string,"%4d(%4d)",status.users,syscfg.maxusers-status.users);my_printf(string);
- + gotoxy(30,8);sprintf(string,"%10d",status.callernum1);my_printf(string);
- + gotoxy(30,10);my_printf(VERSION_NUMBER);
-
-
- Add the following information:
- = if ((int)timer() != 0)
- = sprintf(string,"%5.2f",100.00*((float)status.activetoday)/((float)timer()/60.00));
- = else
- = sprintf(string,"00.00");
- = my_printf(string);
- /* Add the next few lines */
- /* Print Network Information */
- /* Alternate system to print every 5 seconds */
- if ((int)difftime(timenow,timelast) >= 5)
- {
- i2=-1;
- while (i2 == -1)
- {
- thisnet = (thisnet < num_ncn) ? thisnet+1 : 0;
- csne=next_system(ncn[thisnet].systemnumber);
- i2=-1;
- for (i1=0;i1<num_call_sys;i1++)
- if (con[i1].sysnum==ncn[thisnet].systemnumber)
- i2=i1;
- }
- time(&timelast);
- if (ok_to_call(i2))
- ch='*';
- else
- ch=' ';
- if (ncn[thisnet].lastcontact)
- {
- l1=timenow-ncn[thisnet].lastcontact;
- s=l1%60;l1=(l1-s)/60;
- m=l1%60;
- h=l1/60;
- sprintf(s1,"%02d:%02d:%02d",h,m,s);
- }
- else
- sprintf(s1," -NEVER-");
- gotoxy(7,22);
- sprintf(string,"%5d%c│%-30.30s│%-12.12s│%7ld│%8s",
- ncn[thisnet].systemnumber, ch, csne->name, csne->phone,
- ncn[thisnet].bytes_waiting,s1);
- my_printf(string);
- }
- = printstatus("Waiting for Call");
-
- ----------------------------------------------------------------------
- In the Main add:
- = init(1);
- = vmode();
- = time(&lastcall);
- + time(&timelast);
- + timelast-=(long)10;
- .
- .
- .
- = mainmenu();
- ------------------------------------------------------------------------
- And here is the Modified WFC.MSG to support the network information:
- ------------------------------------------------------------------------
- ┌────────┬─────────────────────────────────────────────────┬────────┐
- │ │ │ │
- └──────┬─┴────────────────────────╥────────────────────────┴─┬──────┘
- │BBS Statistics ║Total for Today │
- ├───────────────┬──────────╫────────────────────┬─────┤
- │# Users(Left) │ ║Calls │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │# Calls │ ║Messages Posted │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │WWIV Version # │ ║Email Sent │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Sysop │ ║Feedback Waiting │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Board │ ║Uploads │ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Time since call│ ║Minutes Users Online│ │
- ├───────────────┼──────────╫────────────────────┼─────┤
- │Time Til Event │ ║% Active Today │ │
- ┌──────┼───────────────┴──────────╨───┬────────────┬───┴───┬─┴──────┐
- │Node *│System Name │Phone │ Bytes │Last Con│
- ╞══════╪══════════════════════════════╪════════════╪═══════╪════════╡
- │ │ │ │ │ │
- ╘══════╧════════╤═════════════════════╧════════════╧╤══════╧════════╛
- │ │
- └───────────────────────────────────┘
-
-
- ------------------------------------------------------------------------
- From there on, just hit F9. But I'd suggest using the Make.
- If you don't use make, you might want to consider it; you can
- put your BBS files in a seperate directory from TC, get output
- in a different directory, and your executables in yet another one.
- Not to mention that it (I believe) is a 2-pass compiler(TCC) and
- it will optomize your code better.
-
- I tried to remember everything I had changed, but knowing me I may have
- forgotten something. If I did, I can be reached at 1@8301 or
- call my BBS "The Thieves Market" at 803-723-7254 300-14400b and I
- autovalidate ANY-Sysop.
-
- Or if you feel like waisting money, you can call me at my voice line:
- 803-853-7632
- Ask for David
-
- I can't think of anything else to say, except the normal disclammer that
- It has been tested on my BBS, with no problems, but I take no responsability
- to what it does to you, your computer, your mother, your mothers blue hair
- or any non mentioned items. But I am willing to help with any sort of
- problems you may have.
-
- ──────────────────────────────────────────────────────────────────────────────
-
- The Doorman #67 @18858
- Sun Jan 26 23:05:48 1992
- For those who decided to use my WFC mod since I added the network stuff, I
- forgot to add the stuff which would not print network information if you aren't
- in the network.
-
- A quick fix would be to add:
- if ((int)difftim(timenow,timelast) >= 5 && syscfg.systemnumber)
-
- the && syscfg.systemnumber to the line above. It would be in the do_wfc()
- I've made a little change to speed it up, but I'll post that later when I get
- the status for the network to include the above better.
-
- Thanks
- 3The Doorman5///
-